package com.cloud.prac.config;

import com.prac.common.result.DataResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class ExceptionAdvice {

    @ExceptionHandler(RuntimeException.class)
    @ResponseBody
    public DataResult<String> defaultHandleException(Exception e) {
        return new DataResult<>(e.getMessage());
    }

}
